package com.zgroup.domain

import com.zgroup.domain.User

class BusinessInfo {
  String area    //区域
  String sector    //板块/商圈
  String propertyType    //物业类型
  String serviceType    //服务类型
  //String estateName	//楼盘名称
  String language    //服务语言
  String webShop    //网络店铺
  String webShopName    //店铺名称
  String selfIntroduction    //自我介绍
  User user
  Estate estate
  static constraints = {
    area(nullable: true)
    sector(nullable: true)
    propertyType(nullable: true)
    serviceType(nullable: true)
    language(nullable: true)
    webShop(nullable: true)
    webShopName(nullable: true)
    selfIntroduction(nullable: true)
    estate(nullable: true)
  }

  static transients = ["areaName", "sectorName"]

  String getAreaName() {
    if (area != null) {
      Dictionary.findByTypeAndCode("SH_DISTRICT", area)?.name
    }
  }

  String getSectorName() {
    if (sector != null) {
      String dicType = "SECTOR"
      Dictionary.findByTypeAndCode(dicType, sector)?.name
    }
  }
}
